<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="bjui-pageContent">
	<c:if test="${empty info.id}">
	<form action="<%=request.getContextPath()%>/t/module/insert.do" data-toggle="validate" data-reload-navtab="true">
	</c:if>
	<c:if test="${not empty info.id}">
	<form action="<%=request.getContextPath()%>/t/module/update.do" data-toggle="validate" data-reload-navtab="true">
		<input type="hidden" name="id" value="${info.id}">
	</c:if>
        <div class="pageFormContent" data-layout-h="0">
            <table class="table table-condensed table-hover" width="100%">
                <tbody>
					<tr>
						 <td colspan="2">
	                        <label class="control-label x100">模块编号：</label>
	                        <input readonly="readonly" id="modCode" type="text" name="modCode" value="${info.modCode}" size="60">
	                        <button type="button" class="btn-default" onclick="generateUUID()">随机生成编号</button>
	                    </td>
		    		</tr>
					<tr>
						 <td colspan="2">
	                        <label class="control-label x100">模块名称：</label>
	                        <input type="text" name="modName" value="${info.modName}" size="60">
	                    </td>
		    		</tr>
		    		<tr>
						 <td colspan="2">
	                        <label class="control-label x100">模块层级：</label>
	                        <select name="modLevel" data-toggle="selectpicker">
							    <option value="2" <c:if test="${info.modLevel==2}">selected="selected"</c:if>>二级菜单</option>
							    <option value="1" <c:if test="${info.modLevel==1}">selected="selected"</c:if>>一级菜单</option>
							</select>
	                    </td>
		    		</tr>
					<tr>
						 <td colspan="2">
	                        <label class="control-label x100">上级编号：</label>
	                        <input readonly="readonly" type="text" name="parentCode" value="${info.parentCode}${code}" size="60">
	                    </td>
		    		</tr>
		    		<c:if test="${info.modLevel==2}">
					<tr>
						 <td colspan="2">
	                        <label class="control-label x100">访问地址：</label>
	                        <input type="text" name="modUrl" value="${info.modUrl}" size="60">
	                    </td>
		    		</tr>
		    		</c:if>
                </tbody>
            </table>
        </div>
    </form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
    </ul>
</div>
<script type="text/javascript">
    function doc_upload_success(file, data) {
        var json = $.parseJSON(data);
        $(this).bjuiajax('ajaxDone', json);
        if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
            $('#doc_pic').val(json.filename);
            $('#doc_span_pic').html('已上传图片：<img src="'+json.filename +'" width="100">');
        }
    }
    function generateUUID() {
        var d = new Date().getTime();
        var uuid = 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
            var r = (d + Math.random()*16)%16 | 0;
            d = Math.floor(d/16);
            return (c=='x' ? r : (r&0x7|0x8)).toString(16);
        });
        $("#modCode").val(uuid);
    };
</script>